[SUBROUTINE]
version = 1.14
icon = circle-2.png
name = _("Circle 2 points")
type = circle-2
help = _("<b>Create a Circle by defining ends of diameter</b>&#10;Points are the ends of the diameter and can add a flat")
order = act fcut h1 x1 y1 x2 y2 h2 f rot h3 opt xa dir s u_s ugc dpt u_dpt ugcd h4 fp fc

[PARAM_ACT]
name = _("Active")
icon = enable.png
type = bool
value = 1

[PARAM_FCUT]
name = _("Show design")
icon = glasses.png
type = bool
value = 1

[PARAM_H1]
name = _("Coords")
type = sub-header

[PARAM_X1]
name = _("X1")
type = float
icon = x.png
tool_tip = _("One end of the diameter")
value = 0.0
metric_value = 0.0
header = h1

[PARAM_Y1]
name = _("Y1")
type = float
icon = y.png
tool_tip = _("One end of the diameter")
value = 0.0
metric_value = 0.0
header = h1

[PARAM_X2]
name = _("X2")
type = float
icon = x.png
tool_tip = _("Opposite end of the diameter")
value = 2
header = h1
metric_value = 50

[PARAM_Y2]
name = _("Y2")
type = float
icon = y.png
tool_tip = _("Opposite end of the diameter")
value = 1
header = h1
metric_value = 25

[PARAM_H2]
name = _("D flat")
type = sub-header

[PARAM_F]
name = _("Remove")
icon = d-flat.png
type = float
minimum_value = 0.0
tool_tip = _("Height to remove from diameter")
value = 0.0
header = h2
metric_value = 0.0

[PARAM_ROT]
name = _("Rotation")
type = float
digits = 2
icon = angle.png
tool_tip = _("Rotation of flat")
value = 0
header = h2
suffix = &#176;

[PARAM_H3]
name = _("Milling")
type = sub-header

[PARAM_OPT]
name = _("Option")
type = combo
options = _("Inside normal=0:Pocket=1:On the line=2:Outside=3")
icon = g4x.png
tool_tip = _("Select tool path")
value = 0
header = h3

[PARAM_XA]
name = _("Arc lead-out")
type = bool
icon = lead-out.png
tool_tip = _("Not if on the line")
value = 1
header = h3

[PARAM_DIR]
name = _("Direction")
type = combo
options = _("Clockwise=2:Counter-Clockwise=3")
icon = cw-ccw.png
tool_tip = _("Direction of path")
value = 3
header = h3

[PARAM_S]
name = _("Cut start")
type = combo-user
options = _("User defined=0:Surface=1:Half=2:One quarter=3:Three quarter=4:G-Code=5")
icon = surface.png
tool_tip = _("Pre or user defined")
value = 1
header = h3
links = u_s=0:ugc=5

[PARAM_U_S]
name = _("User start")
type = float
value = 0.0
metric_value = 0.0
header = h3
hidden = 1

[PARAM_UGC]
name = User gcode
type = gcode
value = 
header = h3
hidden = 1

[PARAM_UGCD]
name = User depth gcode
type = gcode
value =
header = h3
hidden = 1

[PARAM_DPT]
name = _("Cut down to")
type = combo-user
options = _("User defined=0:Through=1:Bottom=2:Half=3:One quarter=4:Three quarter=5:G-Code=6")
icon = depth.png
tool_tip = _("Pre or user defined")
value = 1
header = h3
links = u_dpt=0:ugcd=6

[PARAM_U_DPT]
name = _("User depth")
type = float
value = -0.5
metric_value = -12.0
header = h3
hidden = 1

[PARAM_H4]
name = _("Finishing")
type = sub-header

[PARAM_FP]
name = _("Finishing pass")
type = combo
options = _("None=0:Clockwise=2:Clockwise full depth=12:Counter-Clockwise=3:Counter-Clockwise full depth=13")
tool_tip = _("Conventional for better finish")
value = 0
header = h4
icon = finish.png

[PARAM_FC]
name = _("Finishing cut")
header = h4
type = float
minimum_value = 0.0
icon = rect-pocket.png
tool_tip = _("Last finishing cut")
value = 0.04
metric_value = 1.0

[DEFINITIONS]
content =
;	<eval>self.include_once(file name here)</eval>

[CALL]
content = 
	(begin #sub_name)
	(circle from ends of diameter author : Fernand Veilleux)
		
	o<#self_id_active> if [#param_act] (if active)
		#<flat#ID> = [#param_f]
		#<delx#ID> = [#param_x2 - #param_x1]
		#<dely#ID> = [#param_y2 - #param_y1]
		#<diameter#ID> = [SQRT[#<delx#ID> * #<delx#ID> + #<dely#ID> * #<dely#ID>]]
		#<cx#ID> = [[#param_x1 + #param_x2] / 2]
		#<cy#ID> = [[#param_y1 + #param_y2] / 2]
	
		o<select> CALL [31] [#param_s] [#param_u_s] [#<surface>] [#<surface> - #<wp_depth> / 2] [#<surface> - #<wp_depth> / 4] [#<bottom> + #<wp_depth> / 4] [#param_ugc]
		o<select> CALL [32] [#param_dpt] [#param_u_dpt] [#<bottom_through>] [#<bottom>] [#<surface> - #<wp_depth> / 2] [#<surface> - #<wp_depth> / 4] [#<bottom> + #<wp_depth> / 4] [#param_ugcd]
	
		o<circle> CALL [#<cx#ID>] [#<cy#ID>] [#<diameter#ID>] [#<flat#ID>] [#param_rot] [#param_opt] [#param_dir] [#31] [#32] [#param_fcut] [#param_fp] [#param_fc] [#param_xa]
			
	o<#self_id_active> endif
	(end #sub_name)
